package com.szxy.item.controller;

import com.szxy.item.service.ItemCategoryService;
import com.szxy.pojo.TbItemCat;
import com.szxy.utils.CatResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther:zwer
 * @Date:2019/9/7 15:37
 * @Description:com.szxy.item.controller
 * @Version:1.0
 **/
@RestController
@RequestMapping("/service/itemCategory")
public class ItemCategoryController {

    @Autowired
    private ItemCategoryService itemCategoryService;

    @GetMapping("/selectItemCategoryByParentId")
    List<TbItemCat> selectItemCategoryByParentId(@RequestParam  Long id){
        return this.itemCategoryService.selectItemCategoryByParentId(id);
    }

    @GetMapping("/findItemCatByItemId")
    TbItemCat findItemCatByItemId(@RequestParam  Long cid){
        return this.itemCategoryService.findItemCatById(cid);
    }

    @GetMapping("/selectItemCategoryAll")
    CatResult selectItemCategoryAll(){
        return this.itemCategoryService.selectItemCategoryAll();
    }

}
